﻿@using WineStore.Extends;
@using PagedList.Mvc;
@using PagedList;
@model PagedList.IPagedList<WineStore.Models.OrderSim>
@{
    ViewBag.Title = "ShowOrderSimByStatus";
    Layout = "~/Views/Shared/AdminLayout.cshtml";
}
@section Styles
{
    <!--Sử dụng cho autocomplete-->
    <link href="../../Content/themes/base/jquery.ui.all.css" rel="stylesheet" type="text/css" />
    <!--Sử dụng cho paging-->
    <link href="../../Content/PagedList.css" rel="stylesheet" type="text/css" />
    <style type="text/css">
        td {
            text-align: center;
            vertical-align: middle;
        }

        input, textarea, select {
            padding: 5px;
            border: 1px solid #ccc;
            border-radius: 3px;
            width: 200px;
            color: #333;
            box-shadow: rgba(0,0,0,0.1)0px 0px 8px;
            -moz-box-shadow: rgba(0,0,0,0.1)0px 0px 8px;
            -webkit-box-shadow: rgba(0,0,0,0.1)0px 0px 8px;
        }

        textarea {
            width: 400px;
            height: 100px;
            max-width: 400px;
            line-height: 18px;
            border-radius: 3px;
        }


            input:hover, textarea:hover, select:hover, input:focus, textarea:focus, select:focus {
                border-color: 10px solid #C9C9C9;
                box-shadow: rgba(0,0,0,0.2)0px 0px 8px;
                -moz-box-shadow: rgba(0,0,0,0.2)0px 0px 8px;
                -webkit-box-shadow: rgba(0,0,0,0.2)0px 0px 8px;
                border-radius: 3px;
            }

        input .submit {
            height: 38px;
            background-color: #474E69;
            color: #FFF;
            border-radius: 3px;
            -moz-border-radius: 3px;
            -webkit-border-radius: 3px;
        }

        

       #menu_status {
            float:right;
            position: relative;
            top: -35px;
        }

            #menu_status ul {
                margin: 0px;
                padding: 0px;
                list-style-type: none;
            }

            #menu_status li {
                float: left;
                margin-right: 0.5em;
            }

            #menu_status a {
                display: block;
                width: 8em;
                color: white;
                background-color: #0074B3;
                text-decoration: none;
                text-align: center;
            }
    </style>
}
<link href="../../Content/styletablesim.css" rel="stylesheet" />
<script src="../../Scripts/jquery-1.4.4.min.js"></script>
<script type="text/javascript">
    $(function () {
        /* For zebra striping */
        $("table tr:nth-child(odd)").addClass("odd-row");
        /* For cell text alignment */
        $("table td:first-child, table th:first-child").addClass("first");
        /* For removing the last border */
        $("table td:last-child, table th:last-child").addClass("last");
    });
</script>
@section Scripts
{
    <!--Sử dụng cho autocomplete-->
    <script src="../../Scripts/jquery-ui-1.8.11.min.js" type="text/javascript"></script>
    <!--Sử dụng cho autocomplete-->
    <script type="text/javascript" language="javascript">
        $(document).ready(function () {
            $('*[data-autocomplete-url]')
        .each(function () {
            $(this).autocomplete({
                source: $(this).data("autocomplete-url")
            });
        });
        });
    </script>
    <!--Sử dụng cho row hover-->
    <script type="text/javascript">
        $(document).ready(function () {
            $("tr").not(':first').hover(function () {
                $(this).css("background", "#D1EEEE");
            }, function () {
                $(this).css("background", "");
            });
        });
    </script>
}
<!-- Table (TABLE) -->
@if (Session["Admin"] != null)
{
    <h3 class="tit">Quản Lý Đặt Sim
    </h3>
    using (Html.BeginForm())
    {
    <div id="menu_status">
        <ul>
            <li>@Html.ActionLink("Chưa xử lý", "ShowOrderSimByStatus", new { status = 1 })</li>
            <li>@Html.ActionLink("Đã xử lý", "ShowOrderSimByStatus", new { status = 2 })</li>
        </ul>
    </div>
    <table border="1" style="width: 100%;">
       <tr>
            <th>Tên khách hàng
            </th>
            <th>Điện thoại
            </th>
            <th>Số sim
            </th>
            <th>Giá sim
            </th>
            <th>Tên nhà mạng
            </th>
            <th>Nhóm sim
            </th>
            <th>Ngày đặt sim
            </th>
            <th>Trạng thái
            </th>
            <th>Sự kiện
            </th>
        </tr>
        @foreach (var item in Model)
        {
            <tr>
                <td>
                    @Html.DisplayFor(order => item.CusName)
                </td>
                <td>
                    @Html.DisplayFor(order => item.CusPhone)
                </td>
                <td>
                    @Html.DisplayFor(order => item.Sim.SimNumber)
                </td>
                <td>
                    @Html.DisplayFor(order => item.Sim.SimPrice)
                </td>
                <td>
                    @Html.DisplayFor(order => item.Sim.Supplier.SupplierName)
                </td>
                <td>
                    @Html.DisplayFor(order => item.Sim.CategorySim.CategorySimName)
                </td>
                <td>
                    @Html.DisplayFor(order => item.OrderDate)
                </td>
                <td>@ViewBag.StatusDes&nbsp;
                    @{if (@ViewBag.Status == 1)
                      {
                        @Html.ActionLink("Xử lý", "ChangeStatus", new { id = item.OrderSimId, status = ViewBag.Status}, new { @class = "edit" })
                      }
                    }
                </td>
                <td>
                    @Html.ActionLink("Hủy bỏ", "DeleteOrderSim", new { id = item.OrderSimId }, new { @class = "edit" })
                </td>
            </tr>
        }
    </table>
    <!--Paging-->
    @Html.PagedListPager(Model, page => Url.Action("ShowOrderSimByStatus", new { status = ViewBag.Status, page = page}), (PagedListRenderOptions)ViewBag.Pro)
    }
}
else
{
    Response.Redirect("~/Admin/LogOn/");
}